1. Field of the Invention
The present invention relates to a slave device, a time synchronization method in the slave device, a master device, and an electronic equipment system. More particularly, the present invention relates to slave devices enabling realization of time synchronization with a master device with high precision.
2. Description of the Related Art
In recent years, more and more media are digitalized, and many devices recording video streams in digital forms are commercialized as represented by video cameras. Moreover, with the digitalization of video streams, an environment has become widespread in which video streams can be edited easily.
An editing operation will be considered in which video streams captured with a plurality of video cameras are combined into a single video stream. This operation uses a method that correlates the video streams with the capturing times with reference to the timestamps of the video streams to switch between video data captured at the same time, thus constructing a single video stream in which video data are arranged in accordance with the capturing times.
For this to be successful, the internal clocks of all the video cameras used need be correctly synchronized to each other. In the related art, the IEEE 1588 protocol is known to be used for achieving time synchronization of the internal clocks of each electronic equipment in an electronic equipment system in which a plurality of video cameras, for example, is connected via Ethernet (registered trademark).
As is well known in the art, according to the IEEE 1588 protocol (see “Precision Clock Synchronization Protocol for Networked Measurement and Control System”), a slave device calculates and corrects a time difference (Offset) between a master device and the slave device and a path delay (Delay) including a latency between networks or devices, thus synchronizing the time on the slave device to the time on the master device.
FIG. 5 illustrates an exemplary configuration of an electronic equipment system 200 in which time synchronization is achieved using the IEEE 1588 protocol. The electronic equipment system 200 includes a master device 210 and a slave device 220. For example, when the electronic equipment system 200 is a camera system including a plurality of video cameras, the master device 210 is a video camera serving as a parent device, and the slave device 220 is a video camera serving as a child device. Furthermore, when the electronic equipment system 200 is a control system including a controlling device (computer) and a plurality of controlled devices, the master device 210 is the controlling device, and the slave device 220 is the controlled device.
For simplicity's sake, only one slave device 220 is illustrated in FIG. 5. In addition, only those portions related to time synchronization are illustrated in FIG. 5 as the configuration of the master device 210 and the slave device 220, and other portions are omitted.
The master device 210 includes a clock unit 211, a master clock generator 212, a message sending unit 213, and a message receiving unit 214.
The clock unit 211 is configured by a counter that is counted up with master clocks CLKm that are generated by the master clock generator 212. In the case of a video system such as a camera system, the frequency of the master clocks CLKm is 27 MHz, for example, which is typically used as a reference frequency for video transfer. The time information (counter value) that is output from the clock unit 211 is supplied to the message sending unit 213 and the message receiving unit 214.
The message sending unit 213 sends a PTP (Precision Time Protocol) message to the slave device 220 via a transmission line 230 such as Ethernet (registered trademark). Here, in order to include the time information in the PTP message, it is necessary to convert the counter value serving as the time information to a value in a nanosecond (ns) unit. For this purpose, the message sending unit 213 is provided with a counter-value/ns converter 213a that performs conversion from the counter value to the value in a nanosecond (ns) unit. The message receiving unit 214 receives a PTP message that is sent from the slave device 220 via the transmission line 230.
The PTP message that the message sending unit 213 sends to the slave device 220 includes a Sync message, a FollowUp message, and a DelayResponse message. The Sync message is sent to initiate a time synchronization operation. The FollowUp message is sent to convey the time information of the master device 210 after the Sync message is sent. The DelayResponse message is sent as a response to a later-described DelayRequest message after the message receiving unit 214 receives the DelayRequest message from the slave device 220.
The slave device 220 includes a clock unit 221, a slave clock generator 222, a message receiving unit 223, a message sending unit 224, a calculation unit 225, and a correction unit 226.
The clock unit 221 is configured by a counter that is counted up with slave clocks CLKs that are generated by the slave clock generator 222. In the case of a video system such as a camera system, the frequency of the slave clocks CLKs is 27 MHz, for example, similar to the frequency of the master clocks CLKm described above, which is typically used as a reference frequency for video transfer. The time information (counter value) that is output from the clock unit 221 is supplied to the message receiving unit 223 and the message sending unit 224.
The message receiving unit 223 receives the PTP message that is sent from the master device 210 via the transmission line 230. As described above, the time information contained in the PTP message that is sent from the master device 210 is information of a value in a nanosecond (ns) unit. For this purpose, the message receiving unit 223 is provided with an ns/counter-value converter 223a that performs conversion from the value in a nanosecond (ns) unit to the counter value. The message sending unit 224 sends a PTP message to the master device 210 via the transmission line 230.
The PTP message that the message sending unit 224 sends to the master device 210 includes a DelayRequest message. The DelayRequest message is sent to request the master device 210 to issue a DelayResponse message after the FollowUp message sent from the master device 210 is received by the message receiving unit 223.
The calculation unit 225 calculates a correction value necessary for correcting the time on the clock unit 221. Specifically, the calculation unit 225 calculates, as the correction value, an offset of the time St(x) on the clock unit 221 of the slave device 220 relative to the time Mt(x) on the clock unit 211 of the master device 210 by the following equation (1).Offset={(t2−t1)−(t4−t3)}/2  (1)
In the equation above, time t2 is the time at which the Sync message is received by the message receiving unit 223. Time t1 is the time represented by the time information of the FollowUp message that is received by the message receiving unit 223. Time t4 is the time represented by the time information of the DelayResponse message that is received by the message receiving unit 223. Finally, time t3 is the time at which the message sending unit 224 sent (issued) the DelayRequest message to the master device 210.
The correction unit 226 corrects the time on the clock unit 221 based on the offset which is the correction value calculated by the calculation unit 225. The time St(x) on the clock unit 221, which is not corrected, is in a state such that an offset is added to the time Mt(x) on the clock unit 211 of the master device 210. Therefore, the correction unit 226 corrects the time St(x) on the clock unit 221 at the timings synchronized to the slave clocks CLKs generated from the slave clock generator 222 so that the time St(x) has a value subtracted by the offset.
FIG. 6 illustrates a sequence diagram of the time synchronization operation performed in the electronic equipment system 200 illustrated in FIG. 5.
(a) The time synchronization operation is initiated with the message sending unit 213 of the master device 210 sending a Sync message to the slave device 220. In this case, in the message sending unit 213, the issuance (sending) time t1 of the Sync message is stored in the form of the counter value which is the output of the clock unit 211.
(b) In the message receiving unit 223 of the slave device 220, the Sync message sent from the master device 210 is received, and the receipt time t2 of the Sync message is stored in the form of the counter value which is the output of the clock unit 221.
(c) Next, a FollowUp message is sent to the slave device 220 from the message sending unit 213 of the master device 210. The FollowUp message contains the time information representing the issuance time t1 of the Sync message in the form of a value in a nanosecond (ns) unit. In this case, the counter value representing the time t1 is converted to the value in a nanosecond (ns) unit by the counter-value/ns converter 213a of the message sending unit 213.
(d) In the message receiving unit 223 of the slave device 220, the FollowUp message sent from the master device 210 is received, and a value in a nanosecond (ns) unit representing the time t1 is acquired. Moreover, this value is converted to the counter value, which is the output of the clock unit 221 and represents the time t1, by the ns/counter-value converter 223a and the counter value stored in the message receiving unit 223.
(e) Next, a DelayRequest message is sent to the master device 210 from the message sending unit 224 of the slave device 220. In this case, in the message sending unit 224, the issuance (sending) time t3 of the DelayRequest message is stored in the form of the counter value which is the output of the clock unit 221.
(f) In the message receiving unit 214 of the master device 210, the DelayRequest message sent from the slave device 220 is received, and the receipt time t4 of the DelayRequest message is stored in the form of the counter value which is the output of the clock unit 211.
(g) Next, a DelayResponse message is sent to the slave device 220 from the message sending unit 213 of the master device 210. The DelayResponse message contains the time information representing the time t4 when the DelayRequest message is received by the message receiving unit 214 in the form of a value in a nanosecond (ns) unit. In this case, the counter value representing the time t4 is converted to a value in a nanosecond (ns) unit by the counter-value/ns converter 213a of the message sending unit 213.
(h) In the message receiving unit 223 of the slave device 220, the DelayResponse message sent from the master device 210 is received, and the value in a nanosecond (ns) unit representing the time t4 is acquired. Moreover, this value is converted to the counter value, which is the output of the clock unit 221 and represents the time t4, by the ns/counter-value converter 223a, and stored in the message receiving unit 223.
(i) Next, in the calculation unit 225 of the slave device 220, an offset serving as a correction value is calculated by the above-mentioned equation (1) using the counter values, which are stored in the message receiving unit 223 and represent the times t1, t2, and t4, and the counter value which is stored in the message sending unit 224 and represents the time t3. Moreover, the time St(x) on the clock unit 221 is corrected by the correction unit 226 so that the time St(x) has a value subtracted by the offset. In this way, the corrected time St(x)′ on the clock unit 221 is in agreement with the time Mt(x) on the clock unit 211 of the master device 210, and synchronization is achieved.